Repetier-Firmware  1.0.0
HAL Class Reference

#include <HAL.h>

Public Member Functions

 HAL ()
 
virtual ~HAL ()
 
 for (uint16_t i=0;i< 512;i+=2)
 
 while (!(SPSR &(1<< SPIF)))
 

Static Public Member Functions

static void hwSetup (void)
 
static uint16_t integerSqrt (uint32_t a)
 
static int32_t Div4U2U (uint32_t a, uint16_t b)
 Optimized division. More...
 
static unsigned long U16SquaredToU32 (unsigned int val)
 
static unsigned int ComputeV (long timer, long accel)
 
static uint32_t mulu16xu16to32 (unsigned int a, unsigned int b)
 
static unsigned int mulu6xu16shift16 (unsigned int a, unsigned int b)
 
static void digitalWrite (uint8_t pin, uint8_t value)
 
static uint8_t digitalRead (uint8_t pin)
 
static void pinMode (uint8_t pin, uint8_t mode)
 
static int32_t CPUDivU2 (unsigned int divisor)
 approximates division of F_CPU/divisor More...
 
static void delayMicroseconds (unsigned int delayUs)
 
static void delayMilliseconds (unsigned int delayMs)
 
static void tone (uint8_t pin, int duration)
 
static void noTone (uint8_t pin)
 
static void eprSetByte (unsigned int pos, uint8_t value)
 
static void eprSetInt16 (unsigned int pos, int16_t value)
 
static void eprSetInt32 (unsigned int pos, int32_t value)
 
static void eprSetFloat (unsigned int pos, float value)
 
static uint8_t eprGetByte (unsigned int pos)
 
static int16_t eprGetInt16 (unsigned int pos)
 
static int32_t eprGetInt32 (unsigned int pos)
 
static float eprGetFloat (unsigned int pos)
 
static void allowInterrupts ()
 
static void forbidInterrupts ()
 
static millis_t timeInMilliseconds ()
 
static char readFlashByte (PGM_P ptr)
 
static int16_t readFlashWord (PGM_P ptr)
 
static void serialSetBaudrate (long baud)
 
static bool serialByteAvailable ()
 
static uint8_t serialReadByte ()
 
static void serialWriteByte (char b)
 
static void serialFlush ()
 
static void setupTimer ()
 
static void showStartReason ()
 
static int getFreeRam ()
 
static void resetHardware ()
 
static void spiBegin ()
 
static void spiInit (uint8_t spiRate)
 
static uint8_t spiReceive (uint8_t send=0xff)
 
static void spiReadBlock (uint8_t *buf, size_t nbyte)
 
static void spiSend (uint8_t b)
 
static void spiSend (const uint8_t *buf, size_t n)
 
static __attribute__ ((always_inline)) void spiSendBlock(uint8_t token
 
static void i2cSetClockspeed (uint32_t clockSpeedHz)
 
static void i2cInit (uint32_t clockSpeedHz)
 
static unsigned char i2cStart (uint8_t address)
 
static void i2cStartWait (uint8_t address)
 
static void i2cStop (void)
 
static void i2cWrite (uint8_t data)
 
static uint8_t i2cReadAck (void)
 
static uint8_t i2cReadNak (void)
 
static void startWatchdog ()
 
static void stopWatchdog ()
 
static void pingWatchdog ()
 
static float maxExtruderTimerFrequency ()
 
static void analogStart ()
 

Public Attributes

static const uint8_t * buf
 

Constructor & Destructor Documentation

◆ HAL()

HAL::HAL ( )

◆ ~HAL()

HAL::~HAL ( )
virtual

Member Function Documentation

◆ __attribute__()

static HAL::__attribute__ ( (always_inline)  )
inlinestatic

◆ allowInterrupts()

static void HAL::allowInterrupts ( )
inlinestatic

◆ analogStart()

void HAL::analogStart ( )
static

◆ ComputeV()

static unsigned int HAL::ComputeV ( long  timer,
long  accel 
)
inlinestatic

◆ CPUDivU2()

int32_t HAL::CPUDivU2 ( unsigned int  divisor)
static

approximates division of F_CPU/divisor

In the stepper interrupt a division is needed, which is a slow operation. The result is used for timer calculation where small errors are ok. This function uses lookup tables to find a fast approximation of the result.

◆ delayMicroseconds()

static void HAL::delayMicroseconds ( unsigned int  delayUs)
inlinestatic

◆ delayMilliseconds()

static void HAL::delayMilliseconds ( unsigned int  delayMs)
inlinestatic

◆ digitalRead()

static uint8_t HAL::digitalRead ( uint8_t  pin)
inlinestatic

◆ digitalWrite()

static void HAL::digitalWrite ( uint8_t  pin,
uint8_t  value 
)
inlinestatic

◆ Div4U2U()

static int32_t HAL::Div4U2U ( uint32_t  a,
uint16_t  b 
)
inlinestatic

Optimized division.

Normally the C compiler will compute a long/long division, which takes ~670 Ticks. This version is optimized for a 16 bit dividend and recognizes the special cases of a 24 bit and 16 bit dividend, which often, but not always occur in updating the interval.

◆ eprGetByte()

static uint8_t HAL::eprGetByte ( unsigned int  pos)
inlinestatic

◆ eprGetFloat()

static float HAL::eprGetFloat ( unsigned int  pos)
inlinestatic

◆ eprGetInt16()

static int16_t HAL::eprGetInt16 ( unsigned int  pos)
inlinestatic

◆ eprGetInt32()

static int32_t HAL::eprGetInt32 ( unsigned int  pos)
inlinestatic

◆ eprSetByte()

static void HAL::eprSetByte ( unsigned int  pos,
uint8_t  value 
)
inlinestatic

◆ eprSetFloat()

static void HAL::eprSetFloat ( unsigned int  pos,
float  value 
)
inlinestatic

◆ eprSetInt16()

static void HAL::eprSetInt16 ( unsigned int  pos,
int16_t  value 
)
inlinestatic

◆ eprSetInt32()

static void HAL::eprSetInt32 ( unsigned int  pos,
int32_t  value 
)
inlinestatic

◆ for()

HAL::for ( )
inline

◆ forbidInterrupts()

static void HAL::forbidInterrupts ( )
inlinestatic

◆ getFreeRam()

int HAL::getFreeRam ( )
static

◆ hwSetup()

static void HAL::hwSetup ( void  )
inlinestatic

◆ i2cInit()

void HAL::i2cInit ( uint32_t  clockSpeedHz)
static

◆ i2cReadAck()

unsigned char HAL::i2cReadAck ( void  )
static

◆ i2cReadNak()

unsigned char HAL::i2cReadNak ( void  )
static

◆ i2cSetClockspeed()

void HAL::i2cSetClockspeed ( uint32_t  clockSpeedHz)
static

◆ i2cStart()

unsigned char HAL::i2cStart ( uint8_t  address)
static

◆ i2cStartWait()

void HAL::i2cStartWait ( uint8_t  address)
static

◆ i2cStop()

void HAL::i2cStop ( void  )
static

◆ i2cWrite()

void HAL::i2cWrite ( uint8_t  data)
static

◆ integerSqrt()

uint16_t HAL::integerSqrt ( uint32_t  a)
static

◆ maxExtruderTimerFrequency()

static float HAL::maxExtruderTimerFrequency ( )
inlinestatic

◆ mulu16xu16to32()

static uint32_t HAL::mulu16xu16to32 ( unsigned int  a,
unsigned int  b 
)
inlinestatic

◆ mulu6xu16shift16()

static unsigned int HAL::mulu6xu16shift16 ( unsigned int  a,
unsigned int  b 
)
inlinestatic

◆ noTone()

static void HAL::noTone ( uint8_t  pin)
inlinestatic

◆ pingWatchdog()

static void HAL::pingWatchdog ( )
inlinestatic

◆ pinMode()

static void HAL::pinMode ( uint8_t  pin,
uint8_t  mode 
)
inlinestatic

◆ readFlashByte()

static char HAL::readFlashByte ( PGM_P  ptr)
inlinestatic

◆ readFlashWord()

static int16_t HAL::readFlashWord ( PGM_P  ptr)
inlinestatic

◆ resetHardware()

void HAL::resetHardware ( )
static

◆ serialByteAvailable()

static bool HAL::serialByteAvailable ( )
inlinestatic

◆ serialFlush()

static void HAL::serialFlush ( )
inlinestatic

◆ serialReadByte()

static uint8_t HAL::serialReadByte ( )
inlinestatic

◆ serialSetBaudrate()

static void HAL::serialSetBaudrate ( long  baud)
inlinestatic

◆ serialWriteByte()

static void HAL::serialWriteByte ( char  b)
inlinestatic

◆ setupTimer()

void HAL::setupTimer ( )
static

◆ showStartReason()

void HAL::showStartReason ( )
static

◆ spiBegin()

static void HAL::spiBegin ( )
inlinestatic

◆ spiInit()

static void HAL::spiInit ( uint8_t  spiRate)
inlinestatic

◆ spiReadBlock()

static void HAL::spiReadBlock ( uint8_t *  buf,
size_t  nbyte 
)
inlinestatic

◆ spiReceive()

static uint8_t HAL::spiReceive ( uint8_t  send = 0xff)
inlinestatic

◆ spiSend() [1/2]

static void HAL::spiSend ( uint8_t  b)
inlinestatic

◆ spiSend() [2/2]

static void HAL::spiSend ( const uint8_t *  buf,
size_t  n 
)
inlinestatic

◆ startWatchdog()

static void HAL::startWatchdog ( )
inlinestatic

◆ stopWatchdog()

static void HAL::stopWatchdog ( )
inlinestatic

◆ timeInMilliseconds()

static millis_t HAL::timeInMilliseconds ( )
inlinestatic

◆ tone()

static void HAL::tone ( uint8_t  pin,
int  duration 
)
inlinestatic

◆ U16SquaredToU32()

static unsigned long HAL::U16SquaredToU32 ( unsigned int  val)
inlinestatic

◆ while()

HAL::while ( !  SPSR &(1<< SPIF))
inline

Member Data Documentation

◆ buf

const uint8_t* HAL::buf
Initial value:
{
SPDR = token

The documentation for this class was generated from the following files: